package org.shop.controller.user;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

/**
 * 处理用户退出登录 
 * 
 * 1.接收请求 
 * 2.处理请求 - 业务对象 - DAO对象 
 * 3.响应请求
 * 
 * 注意： / == http://localhost:8080/项目名称/
 * 
 * @author Administrator
 * 
 */
@WebServlet("/admin/logout.do")
public class LogoutServlet extends HttpServlet{

	private static final long serialVersionUID = 1L;
	
	
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		// 获取会话对象
		HttpSession session = req.getSession();

		// 让会话对象失效 -- session存储的用户信息也就没有了
		session.invalidate();
		
		// 页面跳转到登录页面
		resp.sendRedirect("login.jsp");
	}

}






